#include <stdio.h>
#include <string.h>

typedef struct
{
  char name[10];
  int age;
} Person;

void updatePerson(Person *p)
{
  p->age = 26;
  strcpy(p->name, "Smith");
}

int main()
{
  Person p1 = {
      "Bob", 18}; // 声明一个Person类型的变量p1
  Person p2 = {"Alice", 20};
  Person p3 = {
      .name = "Charlie",
      .age = 22};
  printf("Name: %s, Age: %d\n", p1.name, p1.age);
  printf("Name: %s, Age: %d\n", p2.name, p2.age);

  printf("change before: %s, Age: %d\n", p3.name, p3.age);
  updatePerson(&p3);
  printf("change after: %s, Age: %d\n", p3.name, p3.age);
}